<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="dp"/>
    <title>Show Forum</title>
</head>
<body>
<g:def var="forumId" value="${params.id}"/>
<g:link controller="discussion" action="create" params="['forum.id': forumId]">Create Post</g:link>
<div class="body">
    <h1>${forum.name} ${forum.description}</h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <div class="dialog">

        <table>
            <thead>
                <tr>
                    <g:sortableColumn property="subject" title="Subject"/>
                    <g:sortableColumn property="date" title="Date"/>
                    <th>Poster</th>
                </tr>
            </thead>
            <tbody>
                <g:each in="${discussionList}" status="i" var="discussion">
                    <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        <td>${discussion.subject?.encodeAsHTML()}</td>
                        <td>${discussion.date?.encodeAsHTML()}</td>
                        <td>${discussion.poster?.encodeAsHTML()}</td>
                    </tr>
                </g:each>
            </tbody>
        </table>

    </div>
    <div class="buttons">
        <g:form>
            <input type="hidden" name="id" value="${forum?.id}"/>
            <span class="button"><g:actionSubmit class="edit" value="Edit"/></span>
            <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete"/></span>
        </g:form>
    </div>
</div>
</body>
</html>
